#pragma once

#include "Document.hpp"




class GlyphModel
	: public QAbstractListModel
{
public:

	typedef StyleDocument::Glyphs   Glyphs;

public:

	GlyphModel(const Document::ptr& document = Document::ptr());

	void setDocument(const Document::ptr& document);

	AdvancedGlyph& glyph(QModelIndex index);
	const AdvancedGlyph& glyph(QModelIndex index) const;

	int rowCount(const QModelIndex& parent = QModelIndex()) const;
	QVariant data(const QModelIndex& index, int role) const;

	void add(const AdvancedGlyph& glyph);
	void remove(const QModelIndex& index);

private:

	int calculateRow(const AdvancedGlyph& glyph) const;

private:

	Document::ptr m_document;
};
///////////////////////////////////////////////////////////////////////////////////////////////////
